﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FinosLibrary;
using System.Data;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
using System.IO;
namespace BattleShip {
    [MessageProcess(MPType.PropClient, appName = "BattleShip")]
    public class PCUserList:ModelLogic {
        public User[] UserList { get; set; }
        public int[] UserNumPage {
            get {
                var array = new int[UserNum/Static.PageSize+1];
                for (var i = 0; i < array.Length; i++) array[i] = i;
                return array;
            }
        }
        private int _PageSelection;
        public int PageSelection {
            get { return _PageSelection; }
            set {
                if (_PageSelection != value) {
                    call("GetUserList", value);
                }
                _PageSelection = value;
                this.NotifyPropertyChanged(x => x.PageSelection);
            }
        }
        public int UserNum { get; set; }
        [MessageMethod]
        public void GotUserNum(int num) {
            UserNum = num;
            this.NotifyPropertyChanged(x => x.UserNum);
            this.NotifyPropertyChanged(x => x.UserNumPage);
            call("GetUserList",0);
        }
        [MessageMethod]
        public void GotUserList(User[] ds) {
            UserList = ds;
            this.NotifyPropertyChanged(x => x.UserList);
        }
    }
}
